Skip to content

Refactor savetables function to exit early for 0 rows - #766

Closed
iodwyer wants to merge 1 commit into
DataIntellectTech:masterfrom
iodwyer:wdb-forcewrite-fix
Closed

iodwyer wants to merge 1 commit into
DataIntellectTech:masterfrom
iodwyer:wdb-forcewrite-fix

Conversation

@iodwyer

@iodwyer iodwyer commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

savetables function doing a lot of unnecessary work when table rows = 0. Added a check to exit early.

@iodwyer

iodwyer commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

This change reduced our CPU usage a nice bit
image

Comment thread code/wdb/writedown.q
]; 0b};

/- exit early if 0 row count, return 0b for no changes to table
if[0 = arows;:0b];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a table didn't receive an update for the day? We still want that one to end up on the disk. We might could introduce another flag "eod" - this would be only called once a day and it definitely would write down all tables.
Rest could be same as your change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this requires more thought. I notice that (in my setup) the sort process calls .wdb.initmissingtables on the wdb only after sort + p attr etc is complete. This could take some time and therefore is too late; it needs to be called around EOD

@iodwyer iodwyer closed this Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants